package com.cong.案例;

import java.util.Scanner;

//索引查找
public class Demo02 {

    public static void main(String[] args) {
        int[] arr={1,2,3,6,54,7,8,9};

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入数字");
        int i1 = scanner.nextInt();
        int dext=-1;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i]==i1){
                dext=i;
                break;
            }
        }
        System.out.println(dext);
    }
}
